package net.sahv.bdyz.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.sahv.bdyz.mapper.AdminRolesAuthorityMapper;
import net.sahv.bdyz.model.AdminRolesAuthority;
import net.sahv.bdyz.util.PageInfo;


@Service
public class AdminRolesAuthorityService {
	
	@Autowired
	private AdminRolesAuthorityMapper adminRolesAuthorityMapper;
	 
	public List<Map<String, Object>> findAll(PageInfo pageInfo, String where, String order){
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("myCount", pageInfo.getCount());
		param.put("pageSize", pageInfo.getPageSize());
		param.put("page", pageInfo.getPage());
		param.put("where", where);
		param.put("order", order);
		List<Map<String, Object>> m = adminRolesAuthorityMapper.findAll(param);
		pageInfo.setCount(Integer.parseInt(param.get("myCount").toString()));
		return m;
	}
	
	
	
	
	public int delete(Integer id){
		return adminRolesAuthorityMapper.deleteByPrimaryKey(id);
	}
	
	public int update(AdminRolesAuthority record){
		int n=adminRolesAuthorityMapper.updateByPrimaryKey(record);
		return n;
	}
	public int save(AdminRolesAuthority record){
		return adminRolesAuthorityMapper.insert(record);
	}
	public int deleteList(int[] ids){
		return adminRolesAuthorityMapper.deleteList(ids);
	}




	public List<Map<String, Object>> selectAuthorityByRoleid(int id) {
		// TODO Auto-generated method stub
		return adminRolesAuthorityMapper.selectAuthorityByRoleid(id);
	}
	
	
}
